package org.jeecg.modules.backstageModule.mapper;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import org.apache.ibatis.annotations.Param;
import org.jeecg.modules.PriceSystemModule.entity.PriceInervalEntity;
import org.jeecg.modules.backstageModule.entity.CategoryTechnologyEntity;
import org.jeecg.modules.backstageModule.entity.DiscountEntity;
import org.jeecg.modules.backstageModule.entity.FabricGroupEntity;
import org.springframework.stereotype.Component;

import java.util.Date;
import java.util.HashMap;
import java.util.List;

@Component
public interface DiscountMapper {

    //查询客户折扣
    IPage<DiscountEntity> getCustDiscountList(Page<DiscountEntity> page, @Param("discountSystemName") String discountSystemName);

    //设置折扣
    int setDiscount(@Param("userId") String userId, @Param("discount") String discount, @Param("discountObject") String discountObject, @Param("discountType") String discountType, @Param("date") Date date);


    //查询有一年消费金额的那个列表
    IPage<DiscountEntity> getCustxiaofeiList(Page<DiscountEntity> page);

    //新增体系结构
    int adddiscountSystem(DiscountEntity entity);


    //客户折扣中的，设置折扣的页面列表查询
    IPage<CategoryTechnologyEntity> getSetdiscountList(Page<CategoryTechnologyEntity> page, @Param("discountId") String discountId,@Param("category") Integer category,@Param("orderType") Integer orderType);

    //获取折扣用户列表
    IPage<DiscountEntity> getDiscountCustomers(Page<DiscountEntity> page,@Param("companyName") String companyName,@Param("companyCode") String companyCode,@Param("discountId") String discountId);


    //删除用户折扣
    int deleteCustomerDiscount(@Param("id") int id);

    //将客户添加到折扣内
    int addUsertoDiscount(@Param("userId") int userId, @Param("discountId") String discountId);

    //某个类别下的某个折扣的设置
    int shezhizhekou(@Param("id") Integer id, @Param("discountRatio") String discountRatio,@Param("discountId")  Object discountId);

    //查询所有的品类
    List<HashMap<String, Object>> getallcategory();


    //查询面料折扣体系
    IPage<CategoryTechnologyEntity> getmianliaodiscountsystemList(Page<CategoryTechnologyEntity> page, @Param("discountId") String discountId, @Param("fabricDiscountSystemName") String fabricDiscountSystemName);

    //查询这个面料折扣体系下的
    List<PriceInervalEntity> getmianliaojietidiscountlist(@Param("fabirDiscountSystemId") String fabirDiscountSystemId);

    //查询这个这个区间的面料阶梯折扣是否已经设置
    String getoldjieti(@Param("fabirDiscountSystemId") String fabirDiscountSystemId,@Param("minNumbers") int minNumbers,@Param("maxNumbers") int maxNumbers);

    //增加一条面料阶梯折扣数据
    int addfabicDiscountjieti(PriceInervalEntity entity);

    //假删除这条面料阶梯折扣数据
    int deletemianliaojieti(@Param("id") int id);

    //查询所有的面料组
    IPage<FabricGroupEntity> getallmianliaogroup(Page<FabricGroupEntity> page,@Param("groupName")  String groupName);

    //将面料组添加到这个面料折扣体系中
    int addgrouptodiscountsystem(@Param("integer") Integer integer, @Param("fabirDiscountSystemId") Integer fabirDiscountSystemId,@Param("date") Date date);

    //添加面料折扣体系
    int addmiantiaoDiscountSystem(CategoryTechnologyEntity entity);

    //查询是价格体系类别是否存在折扣
    String getpricezheke(@Param("discountId") String discountId,@Param("id") int id);

    //插入折扣体系和售价关联
    int insertdisprice(@Param("discountId") String discountId,@Param("id") Integer id,@Param("discountRatio") Object discountRatio,@Param("date") Date date);

    //查看这个面料组是否已经存在过这个面料折扣体系中
    String getgourpindiscountsystem(@Param("integer") Integer integer,@Param("fabirDiscountSystemId")  Integer fabirDiscountSystemId,@Param("discountId") String discountId);
    //更换面料组所属的折扣体系
    int updategrouptodiscountsystem(@Param("integer") Integer integer,@Param("fabirDiscountSystemId") Integer fabirDiscountSystemId,@Param("discountId") String discountId);

    //删除这个折扣体系id下所有的面料组
    void deleteFabricDiscountGroup(@Param("id") int id);

    //删除这个折扣体系id下所有的阶梯
    void deleteFabirLadderDiscount(@Param("id") int id);

    //通过id删除这个面料折扣体系
    int deleteFabricDiscountSystembyId(@Param("id") int id);

    IPage<DiscountEntity> getfabricGroupDiscountbyDiscountId(Page<DiscountEntity> page,@Param("id") String id,@Param("groupName") String groupName,@Param("groupCode") String groupCode);

    //修改某折扣体系下的面料组折扣
    int updateFabricGroupDiscount(@Param("parseInt") int parseInt,@Param("valueOf") String valueOf);

    //查询客户折扣体系详情
    DiscountEntity getdiscountSystemdetail(@Param("id") String id);

    //查询所有面料组id
    List<Integer> getallgourpId();

    //将面料组和折扣体系插进关联表
    void insertgourpandDiscountSystem(@Param("groupId") Integer integer, @Param("id") String id,@Param("date")  Date date);

    //修改折扣体系
    int updatediscountSystem(DiscountEntity entity);

    //删除折扣体系
    int deletediscountSystem(@Param("id")  String id);
}
